package cn.sinohealth;

import cn.sinohealth.model.PropertyType;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author qinminghui
 * @description es field annotation
 * In default, the class is annotated with {@link EsMapper}, its all fields will be contained to
 * es mappings file, but this annotation will define some values about es mapping field
 * @date 2020/9/24
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.CLASS)
public @interface EsField {
    PropertyType type() default PropertyType.KEYWORD;

    /**
     * only use in date type
     *
     * @return
     */
    String format() default "yyyy-MM-dd HH:mm:ss || yyyy-MM-dd";

    /**
     * only use in nested type
     *
     * @return
     */
    Class<?> nestedObject() default Void.class;

    /**
     * copy field value to other field
     * @return field names
     */
    String[] copyTo() default { };

    boolean enabled() default true;
}
